<?php
/**
 * @author GhostWei
 * @date 2012-5-31
 */
class picture_special_photo_concept extends system_concept_abstract {
	
	public function init() {
		$this->setModel('picture_special_photo_model', 'special_photo');
		$this->setModelCols('special_photo', array('special_id', 'photo_id'));
	}

	public function save($row) {
		$row->set('photo_id', intval($row->get('photo_id')));
		$row->set('special_id', intval($row->get('special_id')));
		
		if($row->getPhotoId() && $row->getSpecialId() && 
				!$this->fetch(array('photo_id = ?' => $row->getPhotoId(), 'special_id = ?' => $row->getSpecialId()))
			) {
			$this->getModel('special_photo')->insert($row->getModelData('special_photo'));
		}
		return $row;
	}

}
